package com.cw.jeeyt.dao.impl.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.common.Order;
import com.cw.jeeyt.dao.intf.api.ApiFacadeObjDao;
import com.cw.jeeyt.dao.mapper.api.ApiFacadeObjMapper;
import com.cw.jeeyt.dao.model.api.ApiFacadeObjDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * 接口方法参数对象 dao数据库操作接口
 *
 * @author chenw
 * @version 1.0.0
 */
@Repository
public class ApiFacadeObjDaoImpl implements ApiFacadeObjDao {
    @Autowired
    private ApiFacadeObjMapper apiFacadeObjMapper;

    /**
     * 新增接口方法参数对象
     *
     * @param apiFacadeObj
     * @return 整数
     */
    public Integer insert(ApiFacadeObjDo apiFacadeObj) {
        return apiFacadeObjMapper.insert(apiFacadeObj);
    }

    /**
     * 新增接口方法参数对象不为空的字段
     *
     * @param apiFacadeObj
     * @return 整数
     */
    public Integer insertSelective(ApiFacadeObjDo apiFacadeObj) {
        return apiFacadeObjMapper.insertSelective(apiFacadeObj);
    }

    /**
     * 删除接口方法参数对象
     *
     * @param apiFacadeObj
     */
    public void delete(ApiFacadeObjDo apiFacadeObj) {
        apiFacadeObjMapper.delete(apiFacadeObj);
    }

    /**
     * 修改接口方法参数对象不为null的字段
     *
     * @param apiFacadeObj
     */
    public void updateSelective(ApiFacadeObjDo apiFacadeObj) {
        apiFacadeObjMapper.updateSelective(apiFacadeObj);
    }

    /**
     * 修改接口方法参数对象
     *
     * @param apiFacadeObj
     */
    public void update(ApiFacadeObjDo apiFacadeObj) {
        apiFacadeObjMapper.update(apiFacadeObj);
    }

    /**
     * 根据主键查询接口方法参数对象
     *
     * @return 接口方法参数对象
     */
    public ApiFacadeObjDo getById(Long id) {
        return apiFacadeObjMapper.getById(id);
    }

    /**
     * 查询所有接口方法参数对象
     *
     * @return 接口方法参数对象集合
     */
    public List<ApiFacadeObjDo> queryApiFacadeObjList() {
        return apiFacadeObjMapper.queryApiFacadeObjList();
    }

    /**
     * 分页查询接口方法参数对象
     *
     * @param apiFacadeObj 查询条件
     * @param startRow 开始条数
     * @param pageSize 每页长度
     * @return 接口方法参数对象集合
     */
    public PageInfo<ApiFacadeObjDo> queryByPage(ApiFacadeObjDo apiFacadeObj, Integer startRow, Integer pageSize,
        Order order) {
        PageHelper.startPage(PageUtil.calPageNum(startRow, pageSize), pageSize);
        return new PageInfo<>(apiFacadeObjMapper.queryByPage(apiFacadeObj, order));
    }

    /**
     * 根据包路径、参数对象编码、参数对象类型查询接口方法参数对象
     *
     * @param objCode
     * @param objPackage
     * @param objType
     * @return
     */
    public ApiFacadeObjDo queryByCondition(String objCode, String objPackage, String objType) {
        return apiFacadeObjMapper.queryByCondition(objCode, objPackage, objType);
    }
}
